﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BUS;
using DTO;
using Microsoft.Reporting.WinForms;
using CrystalDecisions.Shared;
using System.IO;
namespace QUANLYDIEMHOCSINH
{
    public partial class frmDiemNhap : Form
    {
        DIEMBUS diembus = new DIEMBUS();
        public frmDiemNhap()
        {
            InitializeComponent();
           
        }
      
        public string NamHoc { get; set; }
        public string HocKy { get; set; }
        public string Lop { get; set; }
        public string Mon { get; set; }
        public int MaHocKy { get; set; }
        public int MaLop { get; set; }
        public int MaMon { get; set; }

        private void frmDiemHS_Load(object sender, EventArgs e)
        {
            DataTable dts = new DataTable();
            dts = diembus.LoadDiem(MaLop, MaHocKy, MaMon);

            crpDanhSachDiem objRpt = new crpDanhSachDiem();
            objRpt.SetDataSource(dts);
            rpDiem.ReportSource = objRpt;
            rpDiem.Refresh();


            //truyền tham số cho report
            ParameterFields crtParamFields = new ParameterFields();
            ParameterDiscreteValue nh = new ParameterDiscreteValue();
            nh.Value = NamHoc;
            ParameterField nam = new ParameterField();
            nam.ParameterFieldName = "txtNamHoc";
            nam.CurrentValues.Add(nh);
            crtParamFields.Add(nam);

            ParameterDiscreteValue l = new ParameterDiscreteValue();
            l.Value = Lop;
            ParameterField lop = new ParameterField();
            lop.ParameterFieldName = "txtLop";
            lop.CurrentValues.Add(l);
            crtParamFields.Add(lop);

            ParameterDiscreteValue hk = new ParameterDiscreteValue();
            hk.Value = HocKy;
            ParameterField hocky = new ParameterField();
            hocky.ParameterFieldName = "txtHocKy";
            hocky.CurrentValues.Add(hk);
            crtParamFields.Add(hocky);

            ParameterDiscreteValue m = new ParameterDiscreteValue();
            m.Value = Mon;
            ParameterField mon = new ParameterField();
            mon.ParameterFieldName = "txtMon";
            mon.CurrentValues.Add(m);
            crtParamFields.Add(mon);

            rpDiem.ParameterFieldInfo = crtParamFields;
        }
    }
}
